package cn.com.bsoft.wePortal.message.service

import cn.com.bsoft.kotlinEx.logger
import org.springframework.data.redis.connection.Message
import org.springframework.data.redis.connection.MessageListener

class RedisMessageSubscriber: MessageListener {
    override fun onMessage(message: Message, pattern: ByteArray?) {

        val channel = String(message.channel,Charsets.UTF_8)
        val body = String(message.body,Charsets.UTF_8)

        var strPattern = ""
        if (pattern != null)
            strPattern = String(pattern,Charsets.UTF_8)

        logger.info("receive body:$body channel:$channel patter:$strPattern")
    }

}